﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DataServer;
using BugsData;
using Model;

namespace LogicServer
{
    public class ReplyLogic
    {
        /// <summary>
        /// 根据bugid获取回复的分页信息
        /// </summary>
        /// <param name="size">size</param>
        /// <param name="index">index</param>
        /// <param name="id">bugid</param>
        /// <returns>dt</returns>
        public DataTable GetReplyListByBugId(int size, int index, int id)
        {
            DataTable dt = new DataTable();
            ReplysData bd = new ReplysData();
            dt = bd.GetReplysByBugId(size, index, id);
            if (dt == null || dt.Rows.Count == 0)
            {
                return null;
            }
            return dt;
        }

        /// <summary>
        /// 根据bugid获取回复条数
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int GetReplyCountByBugId(int id)
        {
            ReplysData bd = new ReplysData();
            return bd.GetReplysCount(id);
        }

        /// <summary>
        /// 添加回复记录并且更新回复条数
        /// </summary>
        /// <param name="rp"></param>
        /// <returns></returns>
        public bool InsertReplys(Replys rp)
        {
            ReplysData reply = new ReplysData();
            BugData bug = new BugData();
            return reply.InsertReply(rp);
        }
    }
}
